-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Renamed count headings in schema summary of html/txt report and fixed all cases to add to invalid count #2073
Conversation
…eports of analyze schema 2. Fixed all the reporting issue case to add to the invalid count based on object names
9d84e02
to
b04558a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with comments
@@ -371,16 +371,6 @@ | |||
"GH": "https://github.com/YugaByte/yugabyte-db/issues/1131", | |||
"MinimumVersionsFixedIn": null | |||
}, | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how come this went away?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as discussed -
As I now added invalid count for this regex -
else if spc := alterViewRegex.FindStringSubmatch(sqlInfo.stmt); spc != nil {
summaryMap["VIEW"].invalidCount[sqlInfo.objName] = true
reportCase(fpath, "ALTER VIEW not supported yet.",
"https://github.com/YugaByte/yugabyte-db/issues/1131", "", "VIEW", spc[1], sqlInfo.formattedStmt, UNSUPPORTED_FEATURES, "")
}
and hence this is not going in this condition -
_, err := queryparser.Parse(sqlStmtInfo.stmt)
if err != nil { //if the Stmt is not already report by any of the regexes
if !summaryMap[objType].invalidCount[sqlStmtInfo.objName] {
reason := fmt.Sprintf("%s - '%s'", UNSUPPORTED_PG_SYNTAX, err.Error())
reportCase(fpath, reason, "https://github.com/yugabyte/yb-voyager/issues/1625",
"Fix the schema as per PG syntax", objType, sqlStmtInfo.objName, sqlStmtInfo.formattedStmt, UNSUPPORTED_FEATURES, "")
}
@@ -8,6 +8,7 @@ | |||
{ | |||
"ObjectType": "SCHEMA", | |||
"TotalCount": 1, | |||
"InvalidCount": 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the logic for determining when a SCHEMA is invalid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is this Create schema with elements regex case -
CREATE SCHEMA hollywood
CREATE TABLE films (title text, release date, awards text[])
CREATE VIEW winners AS
SELECT title, release FROM films WHERE awards IS NOT NULL;
createSchemaRegex.MatchString(sqlInfo.stmt) {
summaryMap["SCHEMA"].invalidCount[sqlInfo.objName] = true
reportCase(fpath, "CREATE SCHEMA with elements not supported yet.",
return newQueryIssue(deferrableConstraintIssue, objectType, objectName, sqlStatement, map[string]interface{}{}) | ||
func NewDeferrableConstraintIssue(objectType string, objectName string, sqlStatement string, constraintName string) QueryIssue { | ||
details := map[string]interface{}{ | ||
"ConstraintName": constraintName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a constant for this.
Object Type : {{ .ObjectType }} | ||
- Total Count : {{ .TotalCount }} | ||
- Valid Count : {{ sub .TotalCount .InvalidCount }} | ||
- Objects With Issues Count : {{ .InvalidCount }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets name it Objects With Issues
, Count is unnecessary.
Also lets rename InvalidCount
variable to ObjectsWithIssues
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But before renaming InvalidCount
we need to see if the json payloads sent to yugabyted and callhome would also change. Are we using the InvalidCount field directly there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest renaming
TotalCount -> TotalObjects
ValidCount -> ObjectsWithoutIssues
InvalidCount -> ObjectWithIssues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also lets rename InvalidCount variable to ObjectsWithIssues ?
No, we discussed this and didn't do it intentionally as it will effect json struct and will then effect yugabyted and callhome as we use it as is.
This is just UI change for HTML and TEXT reports only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we discussed this and didn't do it intentionally as it will effect json struct and will then effect yugabyted and callhome as we use it as is.
yeah but lets add a TODO, so that whenever we bump up the version of yugabyted payload we can consider changing this also.
@@ -254,10 +236,6 @@ var alterTableAddPKOnPartitionIssue = issue.Issue{ | |||
|
|||
func NewAlterTableAddPKOnPartiionIssue(objectType string, objectName string, SqlStatement string) QueryIssue { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: SqlStatement
-> sqlStatement
var constraintIssues = []string{ | ||
queryissue.EXCLUSION_CONSTRAINTS, | ||
queryissue.DEFERRABLE_CONSTRAINTS, | ||
queryissue.PK_UK_ON_COMPLEX_DATATYPE, | ||
} | ||
/* | ||
TODO: | ||
// unsupportedIndexIssue | ||
// ObjectType = INDEX | ||
// ObjectName = idx_name ON table_name | ||
// invalidCount.Type = INDEX | ||
// invalidCount.Name = ObjectName (because this is fully qualified) | ||
// DisplayName = ObjectName | ||
|
||
// deferrableConstraintIssue | ||
// ObjectType = TABLE | ||
// ObjectName = table_name | ||
// invalidCount.Type = TABLE | ||
// invalidCount.Name = ObjectName | ||
// DisplayName = table_name (constraint_name) (!= ObjectName) | ||
|
||
// Solutions | ||
// 1. Define a issue.ObjectDisplayName | ||
// 2. Keep it in issue.Details and write logic in UI layer to construct display name. | ||
*/ | ||
displayObjectName := issueInstance.ObjectName | ||
|
||
constraintName, ok := issueInstance.Details[queryissue.CONSTRAINT_NAME] | ||
if slices.Contains(constraintIssues, issueInstance.Type) && ok { | ||
//In case of constraint issues we add constraint name to the object name as well | ||
displayObjectName = fmt.Sprintf("%s, constraint: (%s)", issueInstance.ObjectName, constraintName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
building displaying name can be a different logic for different issue type.
How about having a function queryissue.GetDisplayObjectName()
for the time being.
func GetDisplayObjectName(issueInstance QueryIssue) string {
}
We might need this display name in the assess migration also? How are we dealing it in assess right now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also sort of running into the need for this with regex functions. I want to display the function names used...
But I think this needs a bit of discussion, there are so many fields out there 😅 it has become confusing. Shall we take this up separately @sanyamsinghal @priyanshi-yb ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Agree, its becoming a bit confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, sure
Describe the changes in this pull request
1.Changes in the Analyze schema HTML/TXT reports and Assess-migration HTML report for
Total Count -> Total Objects
Valid Count -> Object Without Issues
Invalid Count -> Object With Issues
2. Fixed all the reporting issue cases to add to the invalid count based on object names
3. Fixed all the test cases expected files for this
Fixes
Describe if there are any user-facing changes
Changes in the Analyze schema HTML/TXT reports and Assess-migration HTML report for
Total Count -> Total Objects
Valid Count -> Object Without Issues
Invalid Count -> Object With Issues
How was this pull request tested?
Manually tested the HTML and TXT formats
Does your PR have changes that can cause upgrade issues?